package com.yonyou.pmclouds.industryandtype.rmiimpl;

import com.alibaba.dubbo.config.annotation.Service;
import com.yonyou.pmclouds.ApplicationConsts;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.industryandtype.entity.IndustryVO;
import com.yonyou.pmclouds.industryandtype.mapper.IndustryMapper;
import com.yonyou.pmclouds.industryandtype.rmiitf.IndustryQuery;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Slf4j
@Service(interfaceClass = IndustryQuery.class, version = ApplicationConsts.APPLICATION_VERSION)
public class IndustryQueryImpl implements IndustryQuery {

    @Autowired
    private IndustryMapper mapper;

    @Override
    public IndustryVO[] queryAllIndustry() throws BusinessException{
        try {
            IndustryVO[] result = mapper.getAllIndustry();
            return result == null ? new IndustryVO[0] : result;
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            throw new BusinessException();
        }
    }
}
